package net.retorx

import web.JacksonScalaContextResolver
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider
import com.google.inject._
import java.io.File
import name.Names


class RetorxModule(initParamLookup:InitParamLookup) extends AbstractModule {

    def configure() {
        bind(classOf[JacksonScalaContextResolver])
        bind(classOf[JacksonJaxbJsonProvider])
        bind(classOf[AboutInfoService])
        bind(classOf[AdminImageContentService])
        bind(classOf[ImageContentService])
        bind(classOf[ContactService])
        bind(classOf[ImageContentDAO])
        bind(classOf[ImageContentBuilder])
        bind(classOf[InitParamLookup]).toInstance(initParamLookup)
        bind(classOf[File]).annotatedWith(Names.named("content.dir")).toInstance(new File(initParamLookup.getInitParameter("content.dir")))
    }

    @Provides
    @Singleton
    def provideAboutInfoService(factory: AboutInfoFactory) = {
        factory.newAboutInfo()
    }


}